package cn.gson.springmvc.model.pojos;

import javax.persistence.*;
import java.sql.Date;
import java.util.Collection;
import java.util.Objects;

@Entity
public class Southrecord {
    private int southrecordId;
    private Integer southrecordCost;
    private Date southrecordDate;
    private String southrecordPersonel;
    private Collection<Hospinfo> hospinfosBySouthrecordId;

    @Id
    @Column(name = "southrecord_id", nullable = false)
    public int getSouthrecordId() {
        return southrecordId;
    }

    public void setSouthrecordId(int southrecordId) {
        this.southrecordId = southrecordId;
    }

    @Basic
    @Column(name = "southrecord_cost", nullable = true, precision = 0)
    public Integer getSouthrecordCost() {
        return southrecordCost;
    }

    public void setSouthrecordCost(Integer southrecordCost) {
        this.southrecordCost = southrecordCost;
    }

    @Basic
    @Column(name = "southrecord_date", nullable = true)
    public Date getSouthrecordDate() {
        return southrecordDate;
    }

    public void setSouthrecordDate(Date southrecordDate) {
        this.southrecordDate = southrecordDate;
    }

    @Basic
    @Column(name = "southrecord_personel", nullable = true, length = 10)
    public String getSouthrecordPersonel() {
        return southrecordPersonel;
    }

    public void setSouthrecordPersonel(String southrecordPersonel) {
        this.southrecordPersonel = southrecordPersonel;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;
        Southrecord that = (Southrecord) o;
        return southrecordId == that.southrecordId &&
                Objects.equals(southrecordCost, that.southrecordCost) &&
                Objects.equals(southrecordDate, that.southrecordDate) &&
                Objects.equals(southrecordPersonel, that.southrecordPersonel);
    }

    @Override
    public int hashCode() {
        return Objects.hash(southrecordId, southrecordCost, southrecordDate, southrecordPersonel);
    }

    @OneToMany(mappedBy = "southrecordBySouthrecordId")
    public Collection<Hospinfo> getHospinfosBySouthrecordId() {
        return hospinfosBySouthrecordId;
    }

    public void setHospinfosBySouthrecordId(Collection<Hospinfo> hospinfosBySouthrecordId) {
        this.hospinfosBySouthrecordId = hospinfosBySouthrecordId;
    }
}
